# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=x265

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0
pkgrel=1
pkgdesc='Open Source H265/HEVC video encoder (mingw-w64)'
arch=('any')
license=('GPL')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=('yasm' "${MINGW_PACKAGE_PREFIX}-cmake")
options=('strip')
url='https://bitbucket.org/multicoreware/x265'
source=($url/get/$pkgver.tar.bz2
        install-shared-library.patch)
md5sums=('80efe963d3460caa051fe0b10d36bc10'
         'c1dc65fc3191d6bafdd3576235ade5ae')

prepare() {
  cd multicoreware-x265-*
  patch -p1 -i ${srcdir}/install-shared-library.patch
}

build() {
  cd multicoreware-x265-*/build/msys
  ${MINGW_PREFIX}/bin/cmake \
    -G "MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${pkgdir}${MINGW_PREFIX} \
    ../../source
  make
}

package() {
  cd multicoreware-x265-*/build/msys
  make install #DESTDIR="$pkgdir" 
}
